#include<iostream>
using namespace std;
#include<vector>
class ATM {
public:
    ATM() {
        money.resize(5, 0);
    }

    void deposit(vector<int> banknotesCount) {
        for (int i = 0; i < 5; ++i)
            money[i] += banknotesCount[i];
    }

    vector<int> withdraw(int amount) {
        vector<int> now(5);
        for (int i = 4; i >= 0; --i) {
            if (amount>=arr[i]&&money[i]) {
                int del = min(money[i], amount / arr[i]);
                amount -= arr[i] * del;
                now[i] = del;
            }
            if (amount == 0) {
                for (int i = 0; i < 5; ++i)
                    money[i] -= now[i];
                return now;
            }
        }
        return { -1 };
    }
    vector<int> money;
    int arr[5] = { 20,50,100,200,500 };
};

/**
 * Your ATM object will be instantiated and called as such:
 * ATM* obj = new ATM();
 * obj->deposit(banknotesCount);
 * vector<int> param_2 = obj->withdraw(amount);
 */
int main() {
    ATM test;
    test.deposit({ 0,0,1,2,1 });
    test.withdraw(600);
}